import React from 'react';
import { Upload, Icon } from 'antd';

const { Dragger } = Upload;

const DraggerButton = props => (
  <React.Fragment>
    <p className="ant-upload-drag-icon">{props.icon || <Icon type="inbox" />}</p>
    <p className="ant-upload-text">{props.text || '点击或拖拽文件到此处上传'}</p>
    <p className="ant-upload-hint">{props.hint}</p>
  </React.Fragment>
);

const DraggerUpload = React.forwardRef((props, ref) => {
  const { text, icon, hint, value, ...draggerProps } = props;
  return (
    <Dragger multiple {...draggerProps}>
      <DraggerButton icon={icon} text={text} hint={hint} />
    </Dragger>
  );
});

export default DraggerUpload;
